package com.tzjw.marketweixin.filter;

import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 自定义过滤器：一些全局请求处理，日志记录，字符编码转换，权限验证等
 * 注册为组件即生效
 * @author hayden
 * @since 2023/09/16 14:28
 */
@Component
public class CustomFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        System.out.println("1.filter");
        filterChain.doFilter(request, response);
        System.out.println("6.filter");
    }
}


